/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tabelamodelcolumnmodel.cat52;

import tabelamodelcolumnmodel.agenda.*;
import eloma.classe.agenda.AgendaAtividade;
import eloma.classe.cat52.registro.RegistroE01;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Icaro
 */
public class Cat52TableModel extends AbstractTableModel {

    private List<RegistroE01> listRegistro;
    private boolean ordenarPorNome = true;

    public Cat52TableModel(List<RegistroE01> listRegistro) {
        this.listRegistro = listRegistro;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        RegistroE01 r = listRegistro.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return r.getIdRegistroE01();
            case 1:
                return r.getDataFinal();
            case 2:
                return r.getNumeroEcf();
            case 3:
                return r.getCrzInicial();
            case 4:
                return r.getCrzFinal();
        }

        return null;
    }

    @Override
    public int getRowCount() {
        return listRegistro.size();
    }

    @Override
    public int getColumnCount() {
        return 3;
    }

    public RegistroE01 getValoresAgenda(int rowIndex) {
        return listRegistro.get(rowIndex);
    }

    public boolean isOrdenarPorNome() {
        return ordenarPorNome;
    }

    public void setOrdenarPorNome(boolean ordenarPorNome) {
        this.ordenarPorNome = ordenarPorNome;
    }
}
